﻿/*
 * Copyright guangboo49@gmail.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * 
 */

using System;
using System.Collections;
using System.Runtime.InteropServices;
using System.Runtime.CompilerServices;
using Microsoft.Office.Core;
using InlineShape = Interop.Word.InlineShape;
using Microsoft.Office.Interop.Word;

namespace Interop.Word {
    [ComImport, Guid("000209A9-0000-0000-C000-000000000046"), TypeLibType((short)0x10c0)]
    public interface InlineShapes : IEnumerable {
        
        [DispId(0x3e8)]
        Application Application { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x3e8)] get; }
        [DispId(0x3e9)]
        int Creator { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x3e9)] get; }
        [DispId(0x3ea)]
        object Parent { [return: MarshalAs(UnmanagedType.IDispatch)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x3ea)] get; }
        [DispId(1)]
        int Count { [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(1)] get; }
        [return: MarshalAs(UnmanagedType.CustomMarshaler, MarshalType = "", MarshalTypeRef = typeof(EnumeratorToEnumVariantMarshaler), MarshalCookie = "")]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(-4), TypeLibFunc((short)0x400)]
        IEnumerator GetEnumerator();
        [DispId(0)]
        InlineShape this[int Index] { [return: MarshalAs(UnmanagedType.Interface)] [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0)] get; }
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(100)]
        InlineShape AddPicture([In, MarshalAs(UnmanagedType.BStr)] string FileName, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object LinkToFile, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object SaveWithDocument, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x18)]
        InlineShape AddOLEObject([In, Optional, MarshalAs(UnmanagedType.Struct)] ref object ClassType, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object FileName, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object LinkToFile, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object DisplayAsIcon, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object IconFileName, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object IconIndex, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object IconLabel, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x66)]
        InlineShape AddOLEControl([In, Optional, MarshalAs(UnmanagedType.Struct)] ref object ClassType, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(200)]
        InlineShape New([In, MarshalAs(UnmanagedType.Interface)] Range Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x68)]
        InlineShape AddHorizontalLine([In, MarshalAs(UnmanagedType.BStr)] string FileName, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x69)]
        InlineShape AddHorizontalLineStandard([In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x6a)]
        InlineShape AddPictureBullet([In, MarshalAs(UnmanagedType.BStr)] string FileName, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
        [return: MarshalAs(UnmanagedType.Interface)]
        [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime), DispId(0x6b)]
        InlineShape AddChart([In, Optional, DefaultParameterValue((XlChartType)(-1))] XlChartType Type, [In, Optional, MarshalAs(UnmanagedType.Struct)] ref object Range);
    }

    public class EnumeratorToEnumVariantMarshaler : ICustomMarshaler {
        public void CleanUpManagedData(object pManagedObj) {
            throw new NotImplementedException();
        }
        public void CleanUpNativeData(IntPtr pNativeData) {
            throw new NotImplementedException();
        }

        public static ICustomMarshaler GetInstance(string pstrCookie) {
            throw new NotImplementedException();
        }

        public int GetNativeDataSize() {
            throw new NotImplementedException();
        }

        public IntPtr MarshalManagedToNative(object pManagedObj) {
            throw new NotImplementedException();
        }

        public object MarshalNativeToManaged(IntPtr pNativeData) {
            throw new NotImplementedException();
        }
    }
}
